Lord Allah pardoned for you! But why did you permit them to stay behind till it becomes clear to you who was truthful and to know you who were the liars?
The hypocrites in Medina at the time of Messenger were intentionally asking exemption to abstain from the battle. Without having a deep inquiry, Messenger permitted them to abstain from the battle. So, through this verse, the Three-Time-Knower Lord is pardoning to Messenger for that act.
The Battle of Uhud occurred to distinguish the believers and the hypocrites among the followers as explained in verses 3: 166-167. After the battle, Lord gave peace and tranquil sleep for the believers. But the hypocrites were thinking: “Why we were defeated even though we are followers fighting along with the Messenger” as explained in verse 3: 154. Lord asks through verse 32: 18: Is then, the one who is a believer is just like the one who is a transgressor, they are not alike. Verses 29: 2-3 say: Are mankind reckoning that they will be let free just because they say ‘indeed, we believed’ without they are tested? Verily, We have tested those before them, then indeed, Lord knows those who are the Truthful and indeed, He knows those who are the liars. See explanations 2: 99; 5: 94; 8: 2-4 and 55.